# -----------------------------------------------------------------------------------------------
#    file name: 02a. Calculate lat & long values.py
#   Written by: Neil Revello
#   Org Source: ArcGIS/ModelBuilder
#   Created on: Thu Apr 08 2010 07:50:36 PM
#  Modified on: Fri Apr 09 2010 11:57 AM
#     argument: none
#       output: none
#      purpose: Retresh local data set for UIC from DME by selecting UnitType SUM & Infinl and
#               Ownrship is no value or AGRE, BES, UNKN, PARK, WTR, FIRE, PDOT.  Add the Fields
#               need for Quarterly Reporting
#    revisions: none
#        notes: none
#        logic: none
#       errors: none
# -----------------------------------------------------------------------------------------------

# Import system modules
import sys, string, os, arcgisscripting

# Create the Geoprocessor object and Set Environment
gp = arcgisscripting.create()
gp.overwriteoutput = 1
gp.workspace = "c:/temp/"

# Load required toolboxes
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")

# Local variables...

BESUICs_LatLong__1_ = "\\\\Cassio\\GIS2\\PROJECTS\\7750\\UIC_DB\\UIC_DATABASE_91.mdb\\BESUICs_LatLong"
BESUICs_temp__1_ = "\\\\Cassio\\GIS2\\PROJECTS\\7750\\UIC_DB\\UIC_DATABASE_91.mdb\\BESUICs_temp"
BESUICs_LatLong = "\\\\Cassio\\GIS2\\PROJECTS\\7750\\UIC_DB\\UIC_DATABASE_91.mdb\\BESUICs_LatLong"
BESUICs_temp__2_ = "\\\\Cassio\\GIS2\\PROJECTS\\7750\\UIC_DB\\UIC_DATABASE_91.mdb\\BESUICs_temp"
BESUICs__3_ = "\\\\Cassio\\GIS2\\PROJECTS\\7750\\UIC_DB\\UIC_DATABASE_91.mdb\\BESUICs"






# Process: Delete (1)...
gp.Delete_management(BESUICs_LatLong__1_, "FeatureClass")

# Process: Project (1)...
tempEnvironment0 = gp.outputCoordinateSystem
gp.outputCoordinateSystem = "GEOGCS['GCS_North_American_1983_HARN',DATUM['D_North_American_1983_HARN',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
gp.Project_management(BESUICs, BESUICs_temp, "GEOGCS['GCS_North_American_1983_HARN',DATUM['D_North_American_1983_HARN',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]", "", "PROJCS['NAD_1983_HARN_StatePlane_Oregon_North_FIPS_3601',GEOGCS['GCS_North_American_1983_HARN',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Lambert_Conformal_Conic'],PARAMETER['False_Easting',8202099.737532808],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-120.5],PARAMETER['Standard_Parallel_1',44.33333333333334],PARAMETER['Standard_Parallel_2',46.0],PARAMETER['Latitude_Of_Origin',43.66666666666666],UNIT['Foot',0.3048]]")
gp.outputCoordinateSystem = tempEnvironment0



# Process: Add XY Coordinates (2)...
gp.AddXY_management(BESUICs_temp)

# Process: Copy (1)...
gp.Copy_management(BESUICs_temp, BESUICs_LatLong, "")

gp.Delete_management(WaterUICs_temp__1_, "")




# ---------------------------------------------------------------------------
# 02b. Project UIC Registrations to Spatial Coverage.py
# Created on: Thu Apr 08 2010 08:35:31 PM
#   (generated by ArcGIS/ModelBuilder)
# ---------------------------------------------------------------------------

# Import system modules
import sys, string, os, arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")


# Local variables...
UIC_Registration_temp_Projected__5_ = "\\\\Oberon\\GRP104\\UIC_Management_Program\\Registrations\\UIC_Registration.mdb\\UIC_Registration_temp_Projected"
UIC_Registration_temp__2_ = "\\\\Oberon\\GRP104\\UIC_Management_Program\\Registrations\\UIC_Registration.mdb\\UIC_Registration_temp"
UIC_Registration_Spatial__1_ = "\\\\Oberon\\GRP104\\UIC_Management_Program\\Registrations\\UIC_Registration.mdb\\UIC_Registration_Spatial"
UIC_Registration_temp_Projected__1_ = "\\\\Oberon\\GRP104\\UIC_Management_Program\\Registrations\\UIC_Registration.mdb\\UIC_Registration_temp_Projected"
UIC_Registration_temp_Projected__6_ = "\\\\Oberon\\GRP104\\UIC_Management_Program\\Registrations\\UIC_Registration.mdb\\UIC_Registration_temp_Projected"
UIC_Registration_temp_Projected__7_ = "\\\\Oberon\\GRP104\\UIC_Management_Program\\Registrations\\UIC_Registration.mdb\\UIC_Registration_temp_Projected"
UIC_Registration_Spatial__2_ = "\\\\Oberon\\GRP104\\UIC_Management_Program\\Registrations\\UIC_Registration.mdb\\UIC_Registration_Spatial"
UIC_Registration_Spatial = "\\\\Oberon\\GRP104\\UIC_Management_Program\\Registrations\\UIC_Registration.mdb\\UIC_Registration_Spatial"
UIC_Registration_spatial_-_Sirtoby = "Database Connections\\ModelAdmin.sde\\MODELING_DEV.MODELADMIN.UIC_Registration_Spatial"
Sirtoby_-_UIC_Registration_spatial = "Database Connections\\ModelAdmin.sde\\MODELING_DEV.MODELADMIN.UIC_Registration_Spatial"
Delete_succeeded__3_ = "true"
Delete_succeeded__4_ = "true"
UIC_Registration__1_ = "\\\\oberon\\grp104\\UIC_Management_Program\\Registrations\\UIC_Registration.mdb\\UIC_Registration"
Delete_succeeded__1_ = "true"
Delete_succeeded__2_ = "true"
UIC_Registration_Layer__1_ = "UIC_Registration_Layer"

# Process: Make XY Event Layer...
gp.MakeXYEventLayer_management(UIC_Registration__1_, "longDD", "latDD", UIC_Registration_Layer__1_, "")

# Process: Delete (1)...
gp.Delete_management(UIC_Registration_Spatial__1_, "FeatureClass")

# Process: Copy Features (2)...
gp.CopyFeatures_management(UIC_Registration_Layer__1_, UIC_Registration_temp__2_, "", "0", "0", "0")

# Process: Project (1)...
gp.Project_management(UIC_Registration_temp__2_, UIC_Registration_temp_Projected__1_, "PROJCS['NAD_1983_HARN_StatePlane_Oregon_North_FIPS_3601',GEOGCS['GCS_North_American_1983_HARN',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Lambert_Conformal_Conic'],PARAMETER['False_Easting',8202099.737532808],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-120.5],PARAMETER['Standard_Parallel_1',44.33333333333334],PARAMETER['Standard_Parallel_2',46.0],PARAMETER['Latitude_Of_Origin',43.66666666666666],UNIT['Foot',0.3048]]", "", "GEOGCS['GCS_Assumed_Geographic_1',DATUM['D_North_American_1927',SPHEROID['Clarke_1866',6378206.4,294.9786982]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]")

# Process: Add XY Coordinates...
gp.AddXY_management(UIC_Registration_temp_Projected__1_)

# Process: Calculate Field (3)...
gp.CalculateField_management(UIC_Registration_temp_Projected__5_, "longFeet", "[POINT_X]", "VB", "")

# Process: Calculate Field (4)...
gp.CalculateField_management(UIC_Registration_temp_Projected__6_, "latFeet", "[POINT_Y]", "VB", "")

# Process: Copy (1)...
gp.Copy_management(UIC_Registration_temp_Projected__7_, UIC_Registration_Spatial__2_, "")

# Process: Delete Field (1)...
gp.DeleteField_management(UIC_Registration_Spatial__2_, "POINT_X;POINT_Y")

# Process: Copy (2)...
gp.Copy_management(UIC_Registration_Spatial, UIC_Registration_spatial_-_Sirtoby, "")

# Process: Delete (3)...
gp.Delete_management(UIC_Registration_temp_Projected__7_, "")

# Process: Delete (4)...
gp.Delete_management(Sirtoby_-_UIC_Registration_spatial, "FeatureClass")

# Process: Delete (2)...
gp.Delete_management(UIC_Registration_temp__2_, "")



# ---------------------------------------------------------------------------
# 02c. Calculate UIC Registrations lat & long values.py
# Created on: Fri Apr 09 2010 12:44:08 PM
#   (generated by ArcGIS/ModelBuilder)
# ---------------------------------------------------------------------------

# Import system modules
import sys, string, os, arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")


# Local variables...
UIC_Registration_spatial_temp__1_ = "\\\\Oberon\\GRP104\\UIC_Management_Program\\Registrations\\UIC_Registration.mdb\\UIC_Registration_Spatial_temp"
UIC_Registration_LatLong = "\\\\Oberon\\GRP104\\UIC_Management_Program\\Registrations\\UIC_Registration.mdb\\UIC_Registration_LatLong"
UICs_Registration_temp__2_ = "\\\\Oberon\\GRP104\\UIC_Management_Program\\Registrations\\UIC_Registration.mdb\\UIC_Registration_Spatial_temp"
UIC_Registration_LatLong__1_ = "\\\\Oberon\\GRP104\\UIC_Management_Program\\Registrations\\UIC_Registration.mdb\\UIC_Registration_LatLong"
UIC_Registration_Spatial__1_ = "\\\\Oberon\\GRP104\\UIC_Management_Program\\Registrations\\UIC_Registration.mdb\\UIC_Registration_Spatial"
Delete_succeeded__1_ = "true"
Delete_succeeded__2_ = "true"

# Process: Delete (1)...
gp.Delete_management(UIC_Registration_LatLong__1_, "FeatureClass")

# Process: Project (1)...
tempEnvironment0 = gp.outputCoordinateSystem
gp.outputCoordinateSystem = "GEOGCS['GCS_North_American_1983_HARN',DATUM['D_North_American_1983_HARN',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
gp.Project_management(UIC_Registration_Spatial__1_, UIC_Registration_spatial_temp__1_, "GEOGCS['GCS_North_American_1983_HARN',DATUM['D_North_American_1983_HARN',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]", "", "PROJCS['NAD_1983_HARN_StatePlane_Oregon_North_FIPS_3601',GEOGCS['GCS_North_American_1983_HARN',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Lambert_Conformal_Conic'],PARAMETER['False_Easting',8202099.737532808],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-120.5],PARAMETER['Standard_Parallel_1',44.33333333333334],PARAMETER['Standard_Parallel_2',46.0],PARAMETER['Latitude_Of_Origin',43.66666666666666],UNIT['Foot',0.3048]]")
gp.outputCoordinateSystem = tempEnvironment0

# Process: Add XY Coordinates (2)...
gp.AddXY_management(UIC_Registration_spatial_temp__1_)

# Process: Copy (1)...
gp.Copy_management(UICs_Registration_temp__2_, UIC_Registration_LatLong, "")

# Process: Delete (2)...
gp.Delete_management(UIC_Registration_spatial_temp__1_, "")

